﻿@{

    Layout = null;

    List<YQGL.Model.DM_QYBB> YBQYBBList = ViewData["YBQYBBList"] == null ? new List<YQGL.Model.DM_QYBB>() : ViewData["YBQYBBList"] as List<YQGL.Model.DM_QYBB>;

    List<YQGL.Model.DM_QYBB> JBQYBBList = ViewData["JBQYBBList"] == null ? new List<YQGL.Model.DM_QYBB>() : ViewData["JBQYBBList"] as List<YQGL.Model.DM_QYBB>;


    List<YQGL.Model.DM_QYBB> NBQYBBList = ViewData["NBQYBBList"] == null ? new List<YQGL.Model.DM_QYBB>() : ViewData["NBQYBBList"] as List<YQGL.Model.DM_QYBB>;

    List<YQGL.Model.DM_QYBB> FJQYBBList = ViewData["FJQYBBList"] == null ? new List<YQGL.Model.DM_QYBB>() : ViewData["FJQYBBList"] as List<YQGL.Model.DM_QYBB>;


}
@model DateTime
@helper GenerateQYBB(List<YQGL.Model.DM_QYBB> itemList, string LableType, string lx)
{
    List<YQGL.Model.SB_QYBB> SBQYBBList = ViewData["SBQYBBList"] == null ? new List<YQGL.Model.SB_QYBB>() : ViewData["SBQYBBList"] as List<YQGL.Model.SB_QYBB>;
    <div style="padding:0px 0px 0px 0px;">
        <fieldset>
            <legend class="heading" style="font-size:13px;margin-bottom:8px;padding-bottom:8px;">
                <h1 class="label @Html.Raw(LableType)" style="font-size:16px;font-weight:normal;">@lx</h1>&nbsp; 所属日期：@GetStartAndEndTime(lx)
                <span class="text-primary pull-right">填报单位:万元</span>
            </legend>

            <div class="row" style="margin-top:10px;">
                <div class="form-horizontal" role="form">
                    <div class="col-lg-12">
                        <table class="table table-bordered">
                            <thead>
                                <tr>

                                    <th width="28%">指标名称</th>
                                    <th width="20%">本期数</th>



                                    <th width="15%">审核状态</th>
                                    <th width="37%">审核信息</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach (YQGL.Model.DM_QYBB item in itemList)
                                {
                                    <tr>
                                        <td align="center">
                                            <label class="control-label input-sm text-center" style="text-align:center">
                                                @item.BBXM_MC
                                            </label>
                                            @Html.Hidden("BBXM_DM", item.BBXM_DM)
                                        </td>

                                        @if (SBQYBBList.FirstOrDefault(h => h.BBXM_DM == item.BBXM_DM) == null)
                                        {

                                            <td>
                                                <input class="form-control input-sm" type="text" id="@(item.BBXM_DM+"BQS")" name="@(item.BBXM_DM+"BQS")"
                                                       value="">

                                            </td>


                                            <td align="center">
                                                <label class="control-label input-sm text-center" style="text-align:center">未填报</label>

                                            </td>
                                            <td align="center"></td>
                                        }
                                        else
                                        {

                                            <td>
                                                <input class="form-control input-sm" type="text" id="@(item.BBXM_DM+"BQS")" name="@(item.BBXM_DM+"BQS")"
                                                       @Html.Raw(SBQYBBList.FirstOrDefault(h => h.BBXM_DM == item.BBXM_DM & h.LC == "1").ZTDM == "3" ? "readonly=\"readonly\"" : "") value="@(SBQYBBList.FirstOrDefault(h => h.BBXM_DM == item.BBXM_DM&h.LC=="1").JE)">
                                            </td>

                                            <td align="center">
                                                <label class="control-label input-sm text-center" style="text-align:center">@(SBQYBBList.FirstOrDefault(h => h.BBXM_DM == item.BBXM_DM & h.LC == "1").ZTDMStr)</label>

                                            </td>
                                            <td align="center">
                                                <label class="control-label input-sm text-center" style="text-align:center">@(SBQYBBList.FirstOrDefault(h => h.BBXM_DM == item.BBXM_DM & h.LC == "1").SHXX)</label>

                                            </td>
                                        }
                                    </tr>
                                }

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </fieldset>
    </div>

}
@helper GetStartAndEndTime(string lx)
{
    switch (lx)
    {


        case "月报":
            {
                if (Model.Year == 2016 & Model.Month == 5)
                {
                   @: <font color="red"  style="font-size:13px;">   2016年01月01日至2016年05月31日</font>
                }
                else
                {
                    @(new DateTime(Model.Year, Model.Month, 1).ToString("yyyy年MM月dd日") + "至" + new DateTime(Model.Year, Model.Month, 1).AddMonths(1).AddDays(-1).ToString("yyyy年MM月dd日"))
                }

                break;
            }
        case "季报":
            {


                if (Model.Month >= 3 & Model.Month < 6)
                {

                    @(new DateTime(Model.Year, 1, 1).ToString("yyyy年MM月dd日") + "至" + new DateTime(Model.Year, 4, 1).AddDays(-1).ToString("yyyy年MM月dd日"))

                }
                else if (Model.Month >= 6 & Model.Month < 9)
                {

                    @(new DateTime(Model.Year, 4, 1).ToString("yyyy年MM月dd日") + "至" + new DateTime(Model.Year, 7, 1).AddDays(-1).ToString("yyyy年MM月dd日"))
                }
                else if (Model.Month >= 9 & Model.Month < 12)
                {

                    @(new DateTime(Model.Year, 7, 1).ToString("yyyy年MM月dd日") + "至" + new DateTime(Model.Year, 10, 1).AddDays(-1).ToString("yyyy年MM月dd日"))


                }
                else if (Model.Month == 12)
                {
                    @(new DateTime(Model.Year, 10, 1).ToString("yyyy-MM-dd") + "至" + new DateTime(Model.Year + 1, 1, 1).AddDays(-1).ToString("yyyy-MM-dd"));

                }
                else
                {

                    @(new DateTime(Model.Year - 1, 10, 1).ToString("yyyy-MM-dd") + "至" + new DateTime(Model.Year, 1, 1).AddDays(-1).ToString("yyyy-MM-dd"));
                }



                break;
            }

        case "年报":
            {
                if (Model.Month >= 6 & Model.Month <= 12)
                {

                    @(new DateTime(Model.Year, 1, 1).ToString("yyyy年MM月dd日") + "至" + new DateTime(Model.Year + 1, 1, 1).AddDays(-1).ToString("yyyy年MM月dd日"))

                }
                else
                {

                    @(new DateTime(Model.Year - 1, 1, 1).ToString("yyyy年MM月dd日") + "至" + new DateTime(Model.Year, 1, 1).AddDays(-1).ToString("yyyy年MM月dd日"))

                }
                break;

            }

        case "附加报表":
            {
                @(new DateTime(Model.Year, Model.Month, 1).ToString("yyyy年MM月dd日") + "至" + new DateTime(Model.Year, Model.Month, 1).AddMonths(1).AddDays(-1).ToString("yyyy年MM月dd日"))

                break;
            }
        default:
            {

                @(new DateTime(Model.Year, Model.Month, 1).ToString("yyyy年MM月dd日") + "至" + new DateTime(Model.Year, Model.Month, 1).AddMonths(1).AddDays(-1).ToString("yyyy年MM月dd日"))

                break;
            }
    }

}
@if (YBQYBBList.Count > 0)
{
    @GenerateQYBB(YBQYBBList, "label-primary", "月报")
}
@if (JBQYBBList.Count > 0)
{
    @GenerateQYBB(JBQYBBList, "label-success", "季报")
}
@if (NBQYBBList.Count > 0)
{
    @GenerateQYBB(NBQYBBList, "label-info", "年报")
}
@if (FJQYBBList.Count > 0)
{
    @GenerateQYBB(FJQYBBList, "label-warning", "附加报表")



}

@Html.Hidden("hdMethod", ViewData["hdMethod"])